<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Title</title>
</head>
<body>
<script>
    // promise 串联多个操作任务
    new Promise((resolve,reject)=>{
        setTimeout(()=>{
            console.log('执行任务1异步')
            resolve(1)
        },1000)
    }).then(
        value => {
            console.log('任务1 的结果',value)
            console.log('执行任务2 同步')
            return 2
        }
        )
        .then(
            value => {
                console.log('任务2的结果',value)
                return new Promise((resolve, reject) => {
                    setTimeout(()=>{
                        console.log('执行任务3 异步')
                        resolve(3)
                    },1000)
                })
            }
        ).then(
            value => {
                console.log('任务3的结果',value)
            }
    )
</script>
</body>
</html>
